import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/Login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    redirect: '/Login'
  },
  {
    path: '/system',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/system.vue'),
    children: [
      { path: '/goodsList', component: () => import('../components/goods/goodsList.vue'), },
      { path: '/usersList', component: () => import('../components/users/usersList.vue'), },
      { path: '/orderformGoodsList', component: () => import('../components/orderform/orderformGoodsList.vue'), },
      { path: '/orderformStatistics', component: () => import('../components/orderform/orderformStatistics.vue'), },
      { path: '/goodsUpdate', component: () => import('../components/goods/goodsUpdate.vue'), },
      { path: '/goodsUpdate/:_id', props: true, component: () => import('../components/goods/goodsUpdate.vue'), },
      { path: '/goodsadd', component: () => import('../components/goods/goodsadd.vue'), },
      {path:'/adminList',component: () => import('../components/admins/adminList.vue'),},
      {path:'/addAdmins',component: () => import('../components/admins/addAdmins.vue'),},
      {
        path:'/totalcharts',
        component:()=>import('../components/charts/totalcharts.vue')
      },
      {
        path: '/categoryadd',
        component: () => import('../components/category/categoryadd.vue')
      },
      {
        path: '/categoryList',
        component: () => import('../components/category/categoryList.vue')
      },
      {
        path: '/categoryEdit/:_id',
        props:true,
        component: () => import('../components/category/categoryEdit.vue')
      },
      {
        path: '/carouseladd',
        component: () => import('../components/carousel/carouseladd.vue')
      },
      {
        path: '/carouselList',
        component: () => import('../components/carousel/carouselList.vue')
      },
      {
        path: '/carouselEdit/:_id',
        props:true,
        component: () => import('../components/carousel/carouselEdit.vue')
      },
      {
        path: '/orderformTop',
        component: () => import('../components/orderform/orderformtop.vue'),
        children: [
          { path: '/orderformUsersList', component: () => import('../components/orderform/orderformUsersList.vue'), },
        ]
      },
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
